package com.laxcen.basiclib.core.task.core.task;

/**
 * 处理任务帮助类（包含线程创建，任务处理）
 */
class TaskHandler {

    private final TaskThreadHandler mHandler;

    TaskHandler(String threadName, int priority) {
        TaskThread thread = new TaskThread(threadName, priority);
        mHandler = thread.getExecuteHandler();
    }

    public void sendMessage(TaskMessage taskMessage) {
        if (taskMessage == null) {
            return;
        }
        mHandler.sendMessage(taskMessage);
    }

    public void removeMessages(int what) {
        mHandler.removeMessages(what);
    }

    public void removeCallbacksAndMessages() {
        mHandler.removeCallbacksAndMessages(null);
    }

}
